package com.ess.project.examine.record.compute;

import java.util.HashMap;
import java.util.Map;

/**
 * @Description: 3000米跑考核成绩计算
 * @Date: Created in 7:45 下午 2021/3/7
 * @Author: daihui
 * @Modified By:
 */
public class ThreeKmExamineStrategy implements BaseExamine<Integer> {

    private static final Map<Integer, Integer[]> MAN_DIC_DATA = new HashMap<>(13);
    private static final Map<Integer, Integer[]> WOMAN_DIC_DATA = new HashMap<>(13);

    static {
        initDicData();
    }

    private static void initDicData(){
        Integer[] manGradeArray24   = {-820, -815, -815, -810, -810, -790, -790, -775, -775, -760, -760, -745, -745, -730, -730, -715, -715, -690, -690, MAX_NUMBER};
        Integer[] manGradeArray2527 = {-832, -827, -827, -822, -822, -802, -802, -787, -787, -772, -772, -757, -757, -742, -742, -727, -727, -702, -702, MAX_NUMBER};
        Integer[] manGradeArray2830 = {-868, -863, -863, -858, -858, -838, -838, -823, -823, -808, -808, -793, -793, -778, -778, -763, -763, -738, -738, MAX_NUMBER};
        Integer[] manGradeArray3133 = {-900, -895, -895, -884, -884, -874, -874, -859, -859, -844, -844, -829, -829, -814, -814, -799, -799, -774, -774, MAX_NUMBER};
        Integer[] manGradeArray3436 = {-940, -935, -935, -930, -930, -910, -910, -895, -895, -880, -880, -865, -865, -850, -850, -835, -835, -810, -810, MAX_NUMBER};
        Integer[] manGradeArray3739 = {-960, -955, -955, -950, -950, -945, -945, -931, -931, -916, -916, -901, -901, -886, -886, -871, -871, -846, -846, MAX_NUMBER};
        Integer[] manGradeArray4042 = {-1018, -1013, -1013, -1008, -1008, -988, -988, -973, -973, -958, -958, -943, -943, -928, -928, -913, -913, -888, -888, MAX_NUMBER};
        Integer[] manGradeArray4345 = {-1060, -1055, -1055, -1050, -1050, -1030, -1030, -1015, -1015, -1000, -1000, -985, -985, -970, -970, -955, -955, -930, -930, MAX_NUMBER};
        Integer[] manGradeArray4648 = {-1102, -1097, -1097, -1092, -1092, -1072, -1072, -1057, -1057, -1042, -1042, -1027, -1027, -1012, -1012, -997, -997, -972, -972, MAX_NUMBER};
        Integer[] manGradeArray4951 = {-1144, -1139, -1139, -1134, -1134, -1114, -1114, -1099, -1099, -1088, -1088, -1069, -1069, -1054, -1054, -1039, -1039, -1014, -1014, MAX_NUMBER};
        Integer[] manGradeArray5254 = {-1186, -1181, -1181, -1176, -1176, -1156, -1156, -1141, -1141, -1130, -1130, -1111, -1111, -1096, -1096, -1081, -1081, -1056, -1056, MAX_NUMBER};
        Integer[] manGradeArray5557 = {-1228, -1223, -1223, -1218, -1218, -1198, -1198, -1183, -1183, -1172, -1172, -1153, -1153, -1138, -1138, -1123, -1123, -1098, -1098, MAX_NUMBER};
        Integer[] manGradeArray5860 = {-1270, -1265, -1265, -1260, -1260, -1240, -1240, -1225, -1225, -1214, -1214, -1195, -1195, -1180, -1180, -1165, -1165, -1140, -1140, MAX_NUMBER};
        MAN_DIC_DATA.put(DATA_KEY_24, manGradeArray24);
        MAN_DIC_DATA.put(DATA_KEY_2527, manGradeArray2527);
        MAN_DIC_DATA.put(DATA_KEY_2830, manGradeArray2830);
        MAN_DIC_DATA.put(DATA_KEY_3133, manGradeArray3133);
        MAN_DIC_DATA.put(DATA_KEY_3436, manGradeArray3436);
        MAN_DIC_DATA.put(DATA_KEY_3739, manGradeArray3739);
        MAN_DIC_DATA.put(DATA_KEY_4042, manGradeArray4042);
        MAN_DIC_DATA.put(DATA_KEY_4345, manGradeArray4345);
        MAN_DIC_DATA.put(DATA_KEY_4648, manGradeArray4648);
        MAN_DIC_DATA.put(DATA_KEY_4951, manGradeArray4951);
        MAN_DIC_DATA.put(DATA_KEY_5254, manGradeArray5254);
        MAN_DIC_DATA.put(DATA_KEY_5557, manGradeArray5557);
        MAN_DIC_DATA.put(DATA_KEY_5860, manGradeArray5860);
        Integer[] womanGradeArray24   = {-970, -965, -965, -960, -960, -940, -940, -925, -925, -910, -910, -895, -895, -880, -880, -865, -865, -840, -840, MAX_NUMBER};
        Integer[] womanGradeArray2527 = {-983, -978, -978, -973, -973, -953, -953, -938, -938, -923, -923, -908, -908, -893, -893, -878, -878, -853, -853, MAX_NUMBER};
        Integer[] womanGradeArray2830 = {-1022, -1017, -1017, -1012, -1012, -992, -992, -977, -977, -962, -962, -947, -947, -932, -932, -917, -917, -892, -892, MAX_NUMBER};
        Integer[] womanGradeArray3133 = {-1061, -1056, -1056, -1051, -1051, -1031, -1031, -1016, -1016, -1001, -1001, -986, -986, -971, -971, -956, -956, -931, -931, MAX_NUMBER};
        Integer[] womanGradeArray3436 = {-1100, -1095, -1095, -1090, -1090, -1070, -1070, -1055, -1055, -1040, -1040, -1025, -1025, -1010, -1010, -995, -995, -970, -970, MAX_NUMBER};
        Integer[] womanGradeArray3739 = {-1139, -1134, -1134, -1129, -1129, -1109, -1109, -1094, -1094, -1079, -1079, -1064, -1064, -1049, -1049, -1034, -1034, -1009, -1009, MAX_NUMBER};
        Integer[] womanGradeArray4042 = {-1178, -1173, -1173, -1168, -1168, -1148, -1148, -1133, -1133, -1118, -1118, -1103, -1103, -1088, -1088, -1073, -1073, -1048, -1048, MAX_NUMBER};
        Integer[] womanGradeArray4345 = {-1217, -1212, -1212, -1207, -1207, -1187, -1187, -1172, -1172, -1157, -1157, -1142, -1142, -1127, -1127, -1112, -1112, -1087, -1087, MAX_NUMBER};
        Integer[] womanGradeArray4648 = {-1256, -1251, -1251, -1246, -1246, -1226, -1226, -1211, -1211, -1196, -1196, -1181, -1181, -1166, -1166, -1151, -1151, -1126, -1126, MAX_NUMBER};
        Integer[] womanGradeArray4951 = {-1295, -1290, -1290, -1285, -1285, -1265, -1265, -1250, -1250, -1235, -1235, -1220, -1220, -1205, -1205, -1190, -1190, -1165, -1165, MAX_NUMBER};
        Integer[] womanGradeArray5254 = {-1334, -1329, -1329, -1324, -1324, -1304, -1304, -1289, -1289, -1274, -1274, -1259, -1259, -1244, -1244, -1229, -1229, -1204, -1204, MAX_NUMBER};
        Integer[] womanGradeArray5557 = {-1373, -1368, -1368, -1363, -1363, -1343, -1343, -1328, -1328, -1313, -1313, -1298, -1298, -1283, -1283, -1268, -1268, -1243, -1243, MAX_NUMBER};
        Integer[] womanGradeArray5860 = {-1412, -1407, -1407, -1402, -1402, -1382, -1382, -1367, -1367, -1352, -1352, -1337, -1337, -1322, -1322, -1307, -1307, -1282, -1282, MAX_NUMBER};
        WOMAN_DIC_DATA.put(DATA_KEY_24, womanGradeArray24);
        WOMAN_DIC_DATA.put(DATA_KEY_2527, womanGradeArray2527);
        WOMAN_DIC_DATA.put(DATA_KEY_2830, womanGradeArray2830);
        WOMAN_DIC_DATA.put(DATA_KEY_3133, womanGradeArray3133);
        WOMAN_DIC_DATA.put(DATA_KEY_3436, womanGradeArray3436);
        WOMAN_DIC_DATA.put(DATA_KEY_3739, womanGradeArray3739);
        WOMAN_DIC_DATA.put(DATA_KEY_4042, womanGradeArray4042);
        WOMAN_DIC_DATA.put(DATA_KEY_4345, womanGradeArray4345);
        WOMAN_DIC_DATA.put(DATA_KEY_4648, womanGradeArray4648);
        WOMAN_DIC_DATA.put(DATA_KEY_4951, womanGradeArray4951);
        WOMAN_DIC_DATA.put(DATA_KEY_5254, womanGradeArray5254);
        WOMAN_DIC_DATA.put(DATA_KEY_5557, womanGradeArray5557);
        WOMAN_DIC_DATA.put(DATA_KEY_5860, womanGradeArray5860);
    }

    @Override
    public Integer compute(Object args, String gender, Integer... grade) {
        int age = (int) args;
        int minute = grade[0];
        int second = grade[1];
        second = -(minute * 60 + second);
        Integer[] arr;
        if (MAN.equals(gender)) {
            arr = MAN_DIC_DATA.get(BaseExamine.dicKey(age));
        } else {
            arr = WOMAN_DIC_DATA.get(BaseExamine.dicKey(age));
        }
        return BaseExamine.getScore(second, EXAMINATION_ITEM_3000KM, arr);
    }
}
